{% extends "album_layout.html" %}
{% block content %}
    <header>
        <div class="navbar navbar-dark bg-dark shadow-sm">
            <div class="container d-flex justify-content-between">
                <a href='{{ url_for('welcome') }}' class="navbar-brand d-flex align-items-center" style="color: #000;">
                    <img src="static/logo_empty.png" width="20" height="20" class="mr-2">
                    <strong>Tagto｜{{ web_title }}</strong>
                </a>
                {% if current_user.is_authenticated %}
                    <div>
                        <small class="text-muted mr-2">
                            你好，<a href="{{ url_for('account') }}"><strong style="color: #6c757d;">{{ current_user.username }}</strong></a>。<a class="ml-1" href="{{ url_for('logout') }}">退出</a>
                        </small>
                        <a href='{{ url_for('home') }}' class="btn btn-outline-secondary my-2 btn-sm">返回主页</a>
                    </div>
                {% else %}
                    <a href='{{ url_for('login') }}' class="btn btn-primary my-2 btn-sm" style="background-image: linear-gradient(125deg,#806fff, rgb(215, 62, 229) 22.69%, rgb(255, 97, 0) 61.76%, #ff3878);background-size: 400%;animation: bganimation 15s infinite; color: white; border-radius: 0.25rem;border-color:white;">登陆</a>
                {% endif %}
            </div>
        </div>
    </header>
    <main role="main">
        <section class="jumbotron text-center" style="background-image: linear-gradient(125deg,#806fff, rgb(215, 62, 229) 22.69%, rgb(255, 97, 0) 61.76%, #ff3878); background-size: 400%; animation: bganimation 15s infinite;border-radius: 0;">
            <div class="container">
                <h1 style="color: white;"><strong>{{ current_user.username }}</strong></h1>
            </div>
        </section>

        <div class="album py-5 bg-light">
            <div class="container">
                <div class="row" data-masonry='{"percentPosition": true }'>
                    {% for post in posts %}
                        <div class="col-md-4">
                            <div class="card mb-4 shadow-sm">
                                <img class="bd-placeholder-img card-img-top" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" role="img" src="{{ post.url }}">
                                <div class="card-body">
                                    <p class="album_card_title" style="font-weight: 500;font-size: 1.5rem;">{{ post.title }}</p>
                                    <p class="card-text">{{ post.details }}</p>
                                    <div class="d-flex justify-content-between align-items-center">
                                        <span class="badge badge-light"># {{ post.tag }}</span>
                                        <small class="text-muted"><strong>{{ post.author.username }}</strong>｜{{ post.date_posted.strftime('%Y-%m-%d') }}</small>
                                    </div>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    </main>
{% endblock content %}
